import React from "react";
// import React from "./react";

const  loading = (msg)=> (OldComponent)=>{
  return class extends React.Component{
    render(){
      const state = {
        show:()=>console.log('show',msg),
        hide:()=>console.log('hide',msg)
      }
      return <OldComponent {...this.props} {...state}/>
    }
  }
}

@loading('消息')
class Counter extends React.Component{
    render(){
    return (
      <div>
        <p>Counter</p>
        <button onClick={this.props.show}>show</button>
        <button onClick={this.props.hide}>hide</button>
      </div>
    );
    }
}

// let LoadingCounter = loading('消息')(Counter)
// export default LoadingCounter

export default Counter